package kr.ac.jejuuniv.model;

import javax.validation.constraints.Size;

import kr.ac.jejuuniv.repository.UserRepository;
import kr.ac.jejuuniv.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;

import com.sun.istack.internal.NotNull;

@Configurable
public class User {
	
	@NotNull
	@Size(min=1)
	private String id;
	@NotNull
	@Size(min=1)
	private String name;
	@NotNull
	@Size(min=1)
	private String password;
	
	@Autowired
	private UserRepository userRepository;
	
	public User() {
		
	}

	public User(String id, String name, String password) {
		this.setId(id);
		this.setName(name);
		this.setPassword(password);
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPassword() {
		return password;
	}
	
	public User getUser(String id) {
		return userRepository.findById(id);
	}
	

}
